package com.letv.common;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import cn.letv.dict.pinyin.PinYinDictionary;
import cn.letv.dict.pinyin.PinyinResult;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.letv.relatedstar.RelatedStar;
import com.letv.relatedstar.StarLoading;
import com.letv.util.SQLUtil;
import com.letv.util.StringUtil;

public class ProcessData {
	
	private final static Logger log = LoggerFactory.getLogger(ProcessData.class);
	public static String getAlbumStr(Map<String, Object> m) {
		String record = m.get("ID") + "," + m.get("ALBUM_BASE_TYPE") + "," + m.get("ALBUM_TYPE")
				+ "," + m.get("SOURCE_ID") + "," + StringUtil.formatString(m.get("NAME_CN")) + "," + StringUtil.formatString(m.get("NAME_PINYIN_ABB"))
				+ "," + StringUtil.formatString(m.get("NAME_EN")) + "," + StringUtil.formatString(m.get("SUB_TITLE")) + "," + StringUtil.formatString(m.get("VERSION_TITLE"))
				+ "," + StringUtil.formatString(m.get("WEBSITE_TITLE")) + "," + StringUtil.formatString(m.get("MOBILE_TITLE")) + "," + StringUtil.formatString(m.get("TV_TITLE"))
				+ "," + StringUtil.formatString(m.get("ALIAS")) + "," + StringUtil.formatString(m.get("SHORT_DESC")) + "," + StringUtil.formatString(m.get("DESCRIPTION"))
				+ "," + StringUtil.formatString(m.get("TAG")) + "," + m.get("SCORE") + "," + m.get("CATEGORY")
				+ "," + StringUtil.formatString(m.get("SUB_CATEGORY")) + "," + StringUtil.formatString(m.get("DOWNLOAD_PLATFORM")) + "," + StringUtil.formatString(m.get("PLAY_PLATFORM"))
				+ "," + StringUtil.formatString(m.get("PAY_PLATFORM")) + "," + m.get("STATUS") + "," + m.get("DELETED") + "," + m.get("FID")
				+ "," + m.get("FORDER") + "," + StringUtil.formatString(m.get("REMARK")) + "," + m.get("IS_END") + "," + m.get("IS_HEIGHT") + "," + m.get("ALLOW_FORGIEN_PLATFORM")
				+ "," + m.get("DISABLE_TYPE") + "," + StringUtil.formatString(m.get("CONTROL_AREAS")) + "," + StringUtil.formatString(m.get("AREA"))
				+ "," + m.get("COPYRIGHT_TYPE") + "," + StringUtil.formatTime(m.get("COPYRIGHT_START")) + "," + StringUtil.formatTime(m.get("COPYRIGHT_START"))
				+ "," + StringUtil.formatString(m.get("COPYRIGHT_COMPANY")) + "," + m.get("DURATION") + "," + StringUtil.formatString(m.get("RELEASE_DATE")) 
				+ "," + StringUtil.formatTime(m.get("LETV_RELEASE_DATE")) + "," + StringUtil.formatString(m.get("DOUBAN_ID")) + "," + StringUtil.formatString(m.get("IMDB"))
				+ "," + m.get("EPISODE") + "," + StringUtil.formatString(m.get("PLAY_STATUS")) + "," + StringUtil.formatString(m.get("VIP_WATCHING_FOCUS"))
				+ "," + StringUtil.formatString(m.get("MAKER_COMPANY")) + "," + StringUtil.formatString(m.get("DIRECTORY")) + "," + StringUtil.formatString(m.get("ACTOR"))
				+ "," + StringUtil.formatString(m.get("ACTOR_PLAY")) + "," + StringUtil.formatString(m.get("ACTOR_DESC")) + "," + StringUtil.formatString(m.get("ACTOR_PLAY_PIC"))
				+ "," + StringUtil.formatString(m.get("STARRING")) + "," + StringUtil.formatString(m.get("STARRING_PLAY")) + "," + StringUtil.formatString(m.get("STARRING_PLAY_PIC"))
				+ "," + StringUtil.formatString(m.get("STARRING_DESC"))+ "," + StringUtil.formatString(m.get("PIC_COLLECTIONS")) + "," + StringUtil.formatString(m.get("PIC_ORIGINAL"))
				+ "," + StringUtil.formatString(m.get("SCREEN_WRITER")) + "," + StringUtil.formatString(m.get("MAKER")) + "," + StringUtil.formatString(m.get("PAY_DATE"))
				+ "," + m.get("SPORTS_TYPE") + "," + m.get("LETV_MAKE_STYLE") + "," + StringUtil.formatString(m.get("POP_STYLE")) + "," + m.get("LETV_PRODUCE_STYLE") + "," + m.get("FILM_BASE_TYPE") 
				+ "," + StringUtil.formatString(m.get("R_COMPANY")) + "," + StringUtil.formatString(m.get("OFFICIAL_URL")) + "," + m.get("LANGUAGE") + "," + m.get("PREPRICE")
				+ "," + StringUtil.formatString(m.get("FIT_AGE")) + "," + m.get("RECOMM_LEVEL") + "," + StringUtil.formatString(m.get("CAST"))
				+ "," + StringUtil.formatString(m.get("DUB")) + "," + StringUtil.formatString(m.get("PRODUCER")) + "," + StringUtil.formatString(m.get("COMPERE")) 
				+ "," + StringUtil.formatString(m.get("INSTRUCTOR")) + "," + StringUtil.formatString(m.get("MUSIC_AUTHORS")) + "," + StringUtil.formatString(m.get("MUSIC_STYLE"))
				+ "," + StringUtil.formatString(m.get("RECORD_COMPANY")) + "," + StringUtil.formatString(m.get("ISSUE_COMPANY")) + "," + StringUtil.formatString(m.get("MUSIC_COMPOSE"))
				+ "," + m.get("PROGRAM_STYLE") + "," + StringUtil.formatString(m.get("PLAY_TV")) + "," + StringUtil.formatString(m.get("SUPERVISE"))
				+ "," + StringUtil.formatString(m.get("ORIGINATOR")) + "," + StringUtil.formatString(m.get("RECREATION_TYPE")) + "," + StringUtil.formatString(m.get("CARFILM_TYPE"))
				+ "," + StringUtil.formatString(m.get("FIRST_PLAY_TIME")) + "," + StringUtil.formatString(m.get("SCHOOL")) + "," + m.get("IS_FOLLOW") 
				+ "," + m.get("ALLOW_MONTH") + "," + m.get("IS_PAY") + "," + StringUtil.formatString(m.get("PAY_PRODUCT")) + "," + m.get("SINGLE_PRICE") + "," + m.get("DISCOUNT_PRICE")
				+ "," + StringUtil.formatTime(m.get("DISCOUNT_DATE")) + "," + StringUtil.formatTime(m.get("DISCOUNT_DATE_END")) + "," + m.get("FIELD_TYPE")
				+ "," + m.get("TRAVEL_THEME") + "," + m.get("TRAVEL_TYPE") + "," + StringUtil.formatString(m.get("RELATION_ID"))
				+ "," + m.get("IS_HOMEMADE") + "," + m.get("USER_ID") + "," + m.get("UPDATE_UID") + "," + StringUtil.formatTime(m.get("CREATE_TIME")) 
				+ "," + StringUtil.formatTime(m.get("UPDATE_TIME")) + "," + m.get("PARAM1") + "," + StringUtil.formatString(m.get("PARAM2")) + "," + m.get("VARIETY_SHOW")
				+ "," + StringUtil.formatString(m.get("CODE_RATE")) + "," + m.get("daycount") + "," + m.get("FIRST_ID") + "," + StringUtil.formatString(m.get("VIDS"))
				+ "," + StringUtil.formatString(m.get("VID_EPISODE")) + "," + StringUtil.formatString(m.get("ZH_DIRECTORY")) + "," + StringUtil.formatString(m.get("ZH_STARRING"))
				+ "," + m.get("playcount") + "," + StringUtil.formatString(m.get("APPID"))
				+ "," + m.get("PLAY_CONTROL_PLATFORM_CNTV") + "," + m.get("PLAY_CONTROL_PLATFORM_HUASHU")
				+ "," + m.get("PLAY_CONTROL_PLATFORM_GUOGUANG") + "," + StringUtil.formatTime(m.get("VIDEO_FOLLOW_TIME"))
				+ "," + StringUtil.formatString(m.get("STYLE")) + "," + m.get("CONTENT_RATING")
				+ "," + StringUtil.formatString(m.get("ALBUM_PIC")) + "," + StringUtil.formatString(m.get("EXT_DATA"));
		
		return record;
	}
	//读取db_star
	public static String getStarStr(Map<String, Object> m) {
		String record = m.get("ID") + "," + StringUtil.formatString(m.get("NAME"))  + "," + StringUtil.formatString(m.get("ENGLISHNAME"))
				+ "," + StringUtil.formatString(m.get("OTHERNAME")) + "," + StringUtil.formatString(m.get("TRUENAME"))
				+ "," + StringUtil.formatString(m.get("BIRTHDAY")) + "," + m.get("GENDER") + "," + m.get("AREA")
				+ "," + StringUtil.formatString(m.get("DESCRIPTION")) + "," + m.get("DISPLAY") + "," + m.get("ISACTOR")
				+ "," + m.get("ISDIRECTOR") + "," + m.get("IS_AVAIL") + "," + StringUtil.formatString(m.get("PROFESSIONAL"))
				+ "," + StringUtil.formatString(m.get("STATUS")) + "," + StringUtil.formatString(m.get("POST_S1"))
				+ "," + StringUtil.formatString(m.get("POST_S2")) + "," + StringUtil.formatString(m.get("POST_S3"))
				+ "," + StringUtil.formatString(m.get("POST_H1")) + "," + StringUtil.formatString(m.get("POST_H2"))
				+ "," + m.get("DELETED") + "," + m.get("ISEND") + "," + StringUtil.formatString(m.get("PUSHFLAG"))
				+ "," + StringUtil.formatString(m.get("POST_ORIGIN")) + "," + StringUtil.formatString(m.get("PINYINABB"))
				+ "," + StringUtil.formatString(m.get("CREATE_TIME")) + "," + StringUtil.formatString(m.get("UPDATE_TIME"));
		
		return record;
	}
	//读取star_info
    public static String getStarStr_new(Map<String, Object> m) {
        Object pnameo =m.get("professional_name");
        String pname = pnameo==null?"":pnameo.toString();
        Object pido =m.get("professional");
        String pid = pido==null?"":pido.toString();
        if (StringUtils.isNotBlank(pid)
                && pid.indexOf(",") >=0) {
            pname = SQLUtil.getPnameByPid(pid);
        }
        String record = m.get("id") + "," + StringUtil.formatString(m.get("name"))  + "," + StringUtil.formatString(m.get("name_en"))
                + "," + StringUtil.formatString(m.get("othername")) + "," + StringUtil.formatString(m.get("truename"))
                + "," + StringUtil.formatString(m.get("birthday")) + "," + m.get("gender") + "," + m.get("area")
                + "," + StringUtil.formatString(m.get("description")) + "," + m.get("display") + "," + StringUtil.formatString(pid)
                + "," + StringUtil.formatString(m.get("status")) + "," + StringUtil.formatString(m.get("post_s1"))
                + "," + StringUtil.formatString(m.get("post_s2")) + "," + StringUtil.formatString(m.get("post_s3"))
                + "," + StringUtil.formatString(m.get("post_h1")) + "," + StringUtil.formatString(m.get("post_h2"))
                + "," + m.get("deleted") + "," + m.get("isend")+ "," + StringUtil.formatString(m.get("pushflag"))
                + "," + StringUtil.formatString(m.get("post_origin")) + "," + StringUtil.formatString(m.get("pinyinabb"))
                + "," + StringUtil.formatDate(m.get("create_time"), false) + "," + StringUtil.formatDate(m.get("update_time"), false)
                + "," + (m.get("le_id")==null ? -1 : m.get("le_id"))
                + "," + StringUtil.formatString(m.get("area_name")) + "," + StringUtil.formatString(pname)
                + "," + StringUtil.formatString(m.get("head_pic_34")) + "," + StringUtil.formatString(m.get("head_pic_web_34"));
        
        return record;
    }
	
	public static String getVideoStr(Map<String, Object> m) {
		String record = m.get("ID") + "," + m.get("SOURCE_ID") + "," + m.get("VIDEO_TYPE")
				+ "," + m.get("PID") + "," + m.get("PORDER") + "," + StringUtil.formatString(m.get("MID"))
				+ "," + StringUtil.formatString(m.get("NAME_CN")) + "," + StringUtil.formatString(m.get("NAME_PINYIN_ABB")) + "," + StringUtil.formatString(m.get("NAME_EN"))
				+ "," + StringUtil.formatString(m.get("ALIAS")) + "," + StringUtil.formatString(m.get("SUB_TITLE")) + "," + StringUtil.formatString(m.get("WEBSITE_TITLE"))
				+ "," + StringUtil.formatString(m.get("MOBILE_TITLE")) + "," + StringUtil.formatString(m.get("TV_TITLE")) + "," + StringUtil.formatString(m.get("SHORT_DESC"))
				+ "," + StringUtil.formatString(m.get("DESCRIPTION")) + "," + StringUtil.formatString(m.get("TAG")) + "," + m.get("CATEGORY")
				+ "," + StringUtil.formatString(m.get("SUB_CATEGORY")) + "," + StringUtil.formatString(m.get("EPISODE")) + "," + StringUtil.formatString(m.get("WATCHING_FOCUS"))
				+ "," + m.get("COPYRIGHT_TYPE") + "," + StringUtil.formatString(m.get("COPYRIGHT_COMPANY")) + "," + m.get("DISABLE_TYPE")
				+ "," + StringUtil.formatString(m.get("CONTROL_AREAS")) + "," + StringUtil.formatString(m.get("DOWNLOAD_PLATFORM")) + "," + StringUtil.formatString(m.get("PLAY_PLATFORM"))
				+ "," + StringUtil.formatString(m.get("PAY_PLATFORM")) + "," + StringUtil.convertObjectToInteger(m.get("DURATION")) + "," + StringUtil.formatTime(m.get("SCHEDULE_PUBLISH_DATE"))
				+ "," + StringUtil.convertObjectToInteger(m.get("STATUS")) + "," + m.get("DELETED") + "," + m.get("SCORE")
				+ "," + StringUtil.formatString(m.get("PIC_ALL")) + "," + StringUtil.formatString(m.get("PIC_ORIGINAL")) + "," + StringUtil.formatString(m.get("RELEASE_DATE"))
				+ "," + StringUtil.formatString(m.get("AREA")) + "," + m.get("ISSUE") + "," + StringUtil.formatString(m.get("SCHOOL")) + "," + StringUtil.convertObjectToInteger(m.get("IS_HOMEMADE")) 
				+ "," + StringUtil.formatString(m.get("STARRING")) + "," + StringUtil.formatString(m.get("STARTRING_PLAY")) + "," + StringUtil.formatString(m.get("DIRECTORY")) + "," + StringUtil.formatString(m.get("ACTOR"))
				+ "," + StringUtil.formatString(m.get("ACTOR_PLAY")) + "," + m.get("LANGUAGE") + "," + StringUtil.formatString(m.get("SINGLE_NAME")) + "," + StringUtil.formatString(m.get("STYLE")) 
				+ "," + m.get("SPORTS_TYPE") + "," + m.get("LETV_MAKE_STYLE") + "," + StringUtil.formatString(m.get("POP_STYLE")) + "," + m.get("LETV_PRODUCE_STYLE") + "," + StringUtil.formatString(m.get("CARTOON_STYLE"))
				+ "," + StringUtil.formatString(m.get("INSTRUCTOR")) + "," + StringUtil.formatString(m.get("COMPERE")) + "," + StringUtil.formatString(m.get("GUEST"))
				+ "," + StringUtil.formatString(m.get("SINGER")) + "," + StringUtil.formatString(m.get("MUSIC_AUTHORS")) + "," + StringUtil.formatString(m.get("MUSIC_COMPOSE"))
				+ "," + StringUtil.formatTime(m.get("CREATE_TIME")) + "," + StringUtil.formatTime(m.get("UPDATE_TIME")) + "," + StringUtil.formatString(m.get("CODE_RATE")) + "," + m.get("daycount")
				+ "," + StringUtil.formatString(m.get("ZH_ACTOR")) + "," + StringUtil.formatString(m.get("ZH_DIRECTORY")) + "," + m.get("FIELD_TYPE") + "," + StringUtil.formatString(m.get("CARFILM_TYPE"))
				+ "," + StringUtil.formatString(m.get("MUSIC_STYLE")) + "," + m.get("TRAVEL_THEME") + "," + StringUtil.formatString(m.get("RECREATION_TYPE"))
				+ "," + StringUtil.formatString(m.get("SINGER_TYPE")) + "," + StringUtil.formatString(m.get("RECORD_COMPANY")) + "," + m.get("playcount")
				+ "," + StringUtil.formatString(m.get("APPID")) + "," + m.get("USER_ID") + "," + m.get("PLAY_CONTROL_PLATFORM_CNTV") 
				+ "," + m.get("PLAY_CONTROL_PLATFORM_HUASHU") + "," + m.get("PLAY_CONTROL_PLATFORM_GUOGUANG") + "," + StringUtil.formatString(m.get("PLAY_TV"))
				+ "," + m.get("TRAVEL_TYPE") + "," + StringUtil.formatString(m.get("VIDEO_PIC")) + "," + StringUtil.formatString(m.get("PIC_UPLOAD"))
				+ "," + m.get("CONTENT_RATING") + "," + StringUtil.formatString(m.get("AUTO_VIDEO_PIC")) + "," + m.get("IS_PAY");
		
		return record;
	}
	
	public static String getLesoStr(Map<String, Object> m) {
		//log.info("mids={}",m.get("sv_mids"));
		String record = m.get("id") + "," + StringUtil.formatString(m.get("name")) + "," + StringUtil.formatString(m.get("source"))
				+ "," + StringUtil.formatString(m.get("subname")) + "," + StringUtil.formatString(m.get("name_spell")) + "," + StringUtil.formatString(m.get("name_first_spell"))
				+ "," + StringUtil.formatString(m.get("othername")) + "," + StringUtil.formatString(m.get("name_fr")) + "," + m.get("category")
				+ "," + StringUtil.formatString(m.get("director")) + "," + StringUtil.formatString(m.get("actor")) + "," + StringUtil.formatString(m.get("subCategoryName"))
				+ "," + StringUtil.formatString(m.get("areaName")) + "," + StringUtil.formatString(m.get("language")) + "," + StringUtil.formatString(m.get("releaseDate"))
				+ "," + StringUtil.formatString(m.get("shortDesc")) + "," + StringUtil.formatString(m.get("description")) + "," + m.get("rating")
				+ "," + StringUtil.formatString(m.get("poster")) + "," + StringUtil.formatString(m.get("postS1")) + "," + StringUtil.formatString(m.get("postS2"))
				+ "," + StringUtil.formatString(m.get("postS3")) + "," + StringUtil.formatString(m.get("duration")) + "," + StringUtil.formatString(m.get("tag"))
				+ "," + StringUtil.formatString(m.get("hasvideo_pc")) + "," + m.get("hasvideo") + "," + m.get("hasvideo_mobile")
				+ "," + m.get("vid") + "," + StringUtil.formatString(m.get("playurls")) + "," + StringUtil.formatString(m.get("intro"))
				+ "," + m.get("episodes") + "," + StringUtil.formatString(m.get("playStatus")) + "," + m.get("currentEpisode")
				+ "," + StringUtil.formatString(m.get("quality")) + "," + m.get("playCount") + "," + m.get("dayCount")
				+ "," + m.get("weekCount") + "," + m.get("monthCount") + "," + StringUtil.formatString(m.get("photosurl"))
				+ "," + StringUtil.formatString(m.get("url")) + "," + StringUtil.formatString(m.get("detail_link"))
				+ "," + StringUtil.formatString(m.get("pushflag")) 	
				+ "," + StringUtil.formatString(m.get("actor_id")) + "," + StringUtil.formatString(m.get("director_id"))
				+ "," + StringUtil.formatString(m.get("is_pay")) + "," + StringUtil.formatString(m.get("deadlinks"))
				+ "," + StringUtil.formatString(m.get("global_vid"))
				+ "," + StringUtil.formatString(m.get("cmsImages"))
				+ "," + StringUtil.formatString(m.get("albumPic"))
				+ "," + StringUtil.formatString(m.get("images"))+ "," + m.get("video_type")
				+ "," + StringUtil.formatString(m.get("subName"))
                + "," + StringUtil.formatString(m.get("videoSubNames"))+ "," + StringUtil.formatString(m.get("videoImages"))
                + "," + StringUtil.formatString(m.get("source_num"))
                + "," + StringUtil.formatString(m.get("downloadPlatform"))+"," + StringUtil.formatString(m.get("payPlatform"))
                + "," + StringUtil.formatString(m.get("isPays")) + "," + StringUtil.formatString(m.get("starring_leids")) + 
                "," + StringUtil.formatTime(m.get("follow_time")) + "," +  StringUtil.formatString(m.get("white_list"))
                + "," +  StringUtil.formatString(m.get("exterenalIds"))+ "," +  StringUtil.formatString(m.get("sv_mids"))
                + "," + StringUtil.formatString(m.get("letv_vids")) + "," + m.get("vrsAid") + ","
                + StringUtil.formatString(m.get("special_site")) + "," + StringUtil.formatString(m.get("play_status"))
                + "," + StringUtil.formatString(m.get("svids")) + "," + m.get("external_rank") + ","
                + StringUtil.formatString(JSON.toJSONString(m.get("source_list"))) + "," + StringUtil.formatString(m.get("publisher")) + ","
                + m.get("content_type") + "," + StringUtil.formatTime(m.get("create_time")) + ","
                + StringUtil.formatTime(m.get("update_time")) + "," + StringUtil.formatString(m.get("video_durations"))
                + "," + StringUtil.formatString(m.get("video_types")) + "," + StringUtil.formatString(m.get("price"))
                + "," + StringUtil.formatString(m.get("vprice")) + "," + StringUtil.formatString(m.get("starttime"))
                + "," + StringUtil.formatString(m.get("endtime")) + "," + StringUtil.formatString(m.get("display_area"))
                + "," + StringUtil.formatString(m.get("ext_data")) + "," + m.get("cp_info_id") + "," + StringUtil.formatString(m.get("cp_letv_original_id"))
                + "," + StringUtil.formatString(m.get("album_pay_platform")) + "," + StringUtil.formatString(m.get("h5_blocked_city_level"))
                + "," + StringUtil.formatString(m.get("letv_orininal_svids"))
                + "," + StringUtil.formatString(m.get("letvOriginalId"))
		        + "," + StringUtil.convertObjectToInteger(m.get("is_cibn_checked"))
		        + "," + StringUtil.convertObjectToInteger(m.get("if_default_source"))
		        + "," + StringUtil.formatString(m.get("external_id"))
		        + "," + StringUtil.convertObjectToInteger(m.get("is_cibn_show"))
		        + "," + StringUtil.formatString(m.get("external_play_id"))
		        + "," + StringUtil.formatString(m.get("externalPlayIds"))
		        + "," + StringUtil.formatString(m.get("le_id"))
		        + "," + StringUtil.formatString(m.get("area"))
		        + "," + StringUtil.formatString(m.get("sub_category"));
	    return record;
	}
	
    public static void getLesoValues(Map<String, Object> m,ArrayList<Object> values) {
        values.add(m.get("id"));
        values.add(StringUtil.convertObjectToString(m.get("name")));
        values.add(StringUtil.convertObjectToString(m.get("source")));
        values.add(StringUtil.convertObjectToString(m.get("subname")));
        values.add(StringUtil.convertObjectToString(m.get("name_spell")));
        values.add(StringUtil.convertObjectToString(m.get("name_first_spell")));
        values.add(StringUtil.convertObjectToString(m.get("othername")));
        values.add(StringUtil.convertObjectToString(m.get("name_fr")));
        values.add(m.get("category"));
        values.add(StringUtil.convertObjectToString(m.get("director")));
        values.add(StringUtil.convertObjectToString(m.get("actor")));
        values.add(StringUtil.convertObjectToString(m.get("subCategoryName")));
        values.add(StringUtil.convertObjectToString(m.get("areaName")));
        values.add(StringUtil.convertObjectToString(m.get("language")));
        values.add(StringUtil.convertObjectToString(m.get("releaseDate")));
        values.add(StringUtil.convertObjectToString(m.get("shortDesc")));
        values.add(StringUtil.convertObjectToString(m.get("description")));
        values.add(m.get("rating"));
        values.add(StringUtil.convertObjectToString(m.get("poster")));
        values.add(StringUtil.convertObjectToString(m.get("postS1")));
        values.add(StringUtil.convertObjectToString(m.get("postS2")));
        values.add(StringUtil.convertObjectToString(m.get("postS3")));
        values.add(StringUtil.convertObjectToString(m.get("duration")));
        values.add(StringUtil.convertObjectToString(m.get("tag")));
        values.add(StringUtil.convertObjectToString(m.get("hasvideo_pc")));
        values.add(m.get("hasvideo"));
        values.add(m.get("hasvideo_mobile"));
        values.add(m.get("vid"));
        values.add(StringUtil.convertObjectToString(m.get("playurls")));
        values.add(StringUtil.convertObjectToString(m.get("intro")));
        values.add(m.get("episodes"));
        values.add(StringUtil.convertObjectToString(m.get("playStatus")));
        values.add(m.get("currentEpisode"));
        values.add(StringUtil.convertObjectToString(m.get("quality")));
        values.add(m.get("playCount"));
        values.add(m.get("dayCount"));
        values.add(m.get("weekCount"));
        values.add(m.get("monthCount"));
        values.add(StringUtil.convertObjectToString(m.get("photosurl")));
        values.add(StringUtil.convertObjectToString(m.get("url")));
        values.add(StringUtil.convertObjectToString(m.get("detail_link")));
        values.add(StringUtil.convertObjectToString(m.get("pushflag")));
        values.add(StringUtil.convertObjectToString(m.get("actor_id")));
        values.add(StringUtil.convertObjectToString(m.get("director_id")));
        values.add(StringUtil.convertObjectToString(m.get("is_pay")));
        values.add(StringUtil.convertObjectToString(m.get("deadlinks")));
        values.add(StringUtil.convertObjectToString(m.get("global_vid")));
        values.add(StringUtil.convertObjectToString(m.get("cmsImages")));
        values.add(StringUtil.convertObjectToString(m.get("albumPic")));
        values.add(StringUtil.convertObjectToString(m.get("images")));
        values.add(StringUtil.convertObjectToString(m.get("video_type")));
        values.add(StringUtil.convertObjectToString(m.get("subName")));
        values.add(StringUtil.convertObjectToString(m.get("videoSubNames")));
        values.add(StringUtil.convertObjectToString(m.get("videoImages")));
        values.add(m.get("source_num"));
    }

	public static Map<String, Object> processAlbum(Map<String, Object> m, Connection conn) {
		try {
			int display = 0;
			String style = "";
			int country = 0;
			int src = Integer.parseInt(Constants.SRC_VRS);
			int dayCount = StringUtil.convertObjectToInteger(m.get("DAY_COUNT"));
			
			String albumType = StringUtil.convertObjectToString(m.get("ALBUM_TYPE"));
			String albumTypeName = "";
			String category = StringUtil.convertObjectToString(m.get("CATEGORY"));
            String categoryName = Mappings.getDictinaryDefaultValue(m.get("CATEGORY").toString());
			String actor = StringUtil.convertObjectToString(m.get("ACTOR"));
			String actorName = "";
			String actorPlay = StringUtil.convertObjectToString(m.get("ACTOR_PLAY"));
			String maker = StringUtil.convertObjectToString(m.get("MAKER"));
			String rCompany = StringUtil.convertObjectToString(m.get("R_COMPANY"));
			
			String starring = StringUtil.convertObjectToString(m.get("STARRING"));
			String zhStarring = "";
			if (StringUtils.isNotBlank(starring)) {
				StringBuilder sb = new StringBuilder();
				for (String sc : starring.split(",")) {
					String star = Mappings.STAR_MAP.get(sc);
					if (star != null) {
						sb.append(star).append(",");
					}
				}
				zhStarring = sb.toString();
				if (StringUtils.isNotBlank(zhStarring) && zhStarring.endsWith(",")) {
					zhStarring = zhStarring.substring(0, zhStarring.length() - 1);
				}
			}
			String rAlbums = Mappings.RALBUM_MAP.get(StringUtil.convertObjectToString(m.get("ID")));
			
			String directory = StringUtil.convertObjectToString(m.get("DIRECTORY"));
			String zhDirectory = StringUtil.convertObjectToString(m.get("ZH_DIRECTORY"));
			String subCategory = StringUtil.convertObjectToString(m.get("SUB_CATEGORY"));
			String subCategoryName = "";
			String area = StringUtil.convertObjectToString(m.get("AREA"));
			String areaName = "";
			String fitAge = StringUtil.convertObjectToString(m.get("FIT_AGE"));
			String vids = StringUtil.convertObjectToString(m.get("VIDEO_IDS"));
			
			String name = StringUtil.convertObjectToString(m.get("NAME_CN"));
			String nameJianpin = "";
			String nameQuanpin = "";
			String pinyin = LoadDict.chinesePyMap.get(StringUtil.convertObjectToString(m.get("ID")));
			
			if (StringUtils.isNotBlank(pinyin)) {
				String[] words = pinyin.split("@@");
				nameJianpin = words[0];
				nameQuanpin = words[1];
			} else {
				PinyinResult res = PinYinDictionary.getSingleton().converterToSpell(name);
				if (res != null) {
					nameJianpin = res.getFirstSpell();
					nameQuanpin = res.getSpell();
				}
			}
			if (String.valueOf(Constants.SPORTS).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("STYLE"));
				vids = SQLUtil.getVideoIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")));
				if (StringUtils.isNotBlank(vids) && vids.endsWith(",")) {
					vids = vids.substring(0, vids.length() - 1);
				}
			} else if (String.valueOf(Constants.LETVORIGINAL).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("LETV_MAKE_STYLE"));
			} else if (String.valueOf(Constants.FASHION).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("STYLE"));
				vids = SQLUtil.getVideoIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")));
				if (StringUtils.isNotBlank(vids) && vids.endsWith(",")) {
					vids = vids.substring(0, vids.length() - 1);
				}
			} else if (String.valueOf(Constants.MOVIE).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("FILM_BASE_TYPE"));
			} else if (String.valueOf(Constants.TRAVEL).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("LETV_PRODUCE_STYLE"));
				subCategory = StringUtil.convertObjectToString(m.get("SUB_CATEGORY"));
				vids = SQLUtil.getVideoIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")));
				if (StringUtils.isNotBlank(vids) && vids.endsWith(",")) {
					vids = vids.substring(0, vids.length() - 1);
				}
			} else if (String.valueOf(Constants.LETVPRODUCE).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("STYLE"));
			} else if (String.valueOf(Constants.AMUSE).equals(category)) {
				albumType = StringUtil.convertObjectToString(m.get("SUB_CATEGORY"));
			} else if (String.valueOf(Constants.OPENCOURSE).equals(category)) {
				directory = StringUtil.convertObjectToString(m.get("INSTRUCTOR"));
				rCompany = StringUtil.convertObjectToString(m.get("SCHOOL"));
			} else if (String.valueOf(Constants.CARTOON).equals(category)) {
				directory = StringUtil.convertObjectToString(m.get("ORIGINATOR"));
				starring = StringUtil.convertObjectToString(m.get("SUPERVISE"));
				actor = StringUtil.convertObjectToString(m.get("CAST"));
				actorPlay = StringUtil.convertObjectToString(m.get("DUB"));
				if (StringUtils.isNotBlank(starring)) {
					StringBuilder sb = new StringBuilder();
					for (String sc : starring.split(",")) {
						if (Mappings.STAR_MAP.get(sc) != null) {
							sb.append(Mappings.STAR_MAP.get(sc)).append(",");
						}
					}
					zhStarring = sb.toString();
					if (StringUtils.isNotBlank(zhStarring) && zhStarring.endsWith(",")) {
						zhStarring = zhStarring.substring(0, zhStarring.length() - 1);
					}
				}
				if (StringUtils.isNotBlank(directory)) {
					StringBuilder sb = new StringBuilder();
					for (String sc : directory.split(",")) {
						if (Mappings.STAR_MAP.get(sc) != null) {
							sb.append(Mappings.STAR_MAP.get(sc)).append(",");
						}
					}
					zhDirectory = sb.toString();
					if (StringUtils.isNotBlank(zhDirectory) && zhDirectory.endsWith(",")) {
						zhDirectory = zhDirectory.substring(0, zhDirectory.length() - 1);
					}
				}
			} else if (String.valueOf(Constants.VARIETY).equals(category)) {
				starring = StringUtil.convertObjectToString(m.get("COMPERE"));
				if (StringUtils.isNotBlank(starring)) {
					StringBuilder sb = new StringBuilder();
					for (String sc : starring.split(",")) {
						if (Mappings.STAR_MAP.get(sc) != null) {
							sb.append(Mappings.STAR_MAP.get(sc)).append(",");
						}
					}
					zhStarring = sb.toString();
					if (StringUtils.isNotBlank(zhStarring) && zhStarring.endsWith(",")) {
						zhStarring = zhStarring.substring(0, zhStarring.length() - 1);
					}
				}
				
				vids = SQLUtil.getVideoIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")));
				if (StringUtils.isNotBlank(vids) && vids.endsWith(",")) {
					vids = vids.substring(0, vids.length() - 1);
				}
			} else if (String.valueOf(Constants.MUSIC).equals(category)) {
				maker = StringUtil.convertObjectToString(m.get("PRODUCER"));
				
				rCompany = StringUtil.convertObjectToString(m.get("RECORD_COMPANY"));
				
				String mvIds = SQLUtil.getMusicIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")), "MV");
				String concertIds = SQLUtil.getMusicIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")), "Concert");
				String newsIds = SQLUtil.getMusicIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")), "News");
				StringBuilder ids = new StringBuilder();
				
				if (StringUtils.isNotBlank(mvIds)) {
					ids.append(mvIds);
				}
				if (StringUtils.isNotBlank(concertIds)) {
					ids.append(concertIds);
				}
				if (StringUtils.isNotBlank(newsIds)) {
					ids.append(newsIds);
				}
				
				vids = ids.toString();
				if (StringUtils.isNotBlank(vids) && vids.endsWith(",")) {
					vids = vids.substring(0, vids.length() - 1);
				}
			} else if (String.valueOf(Constants.CAR).equals(category)) {
				subCategory = StringUtil.convertObjectToString(m.get("STYLE"));
			} else if (String.valueOf(Constants.FINANCE).equals(category)) {
				subCategory = StringUtil.convertObjectToString(m.get("SUB_CATEGORY"));
				vids = SQLUtil.getVideoIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")));
				if (StringUtils.isNotBlank(vids) && vids.endsWith(",")) {
					vids = vids.substring(0, vids.length() - 1);
				}
			} else if (String.valueOf(Constants.ISSUE).equals(category) 
					|| String.valueOf(Constants.PARENT).equals(category)) {
				vids = SQLUtil.getVideoIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")));
				if (StringUtils.isNotBlank(vids) && vids.endsWith(",")) {
					vids = vids.substring(0, vids.length() - 1);
				}
			} else if (String.valueOf(Constants.DOCUMENTARY).equals(category)) {
				vids = SQLUtil.getDocumentaryIdsByPid(conn, StringUtil.convertObjectToString(m.get("ID")));
				if (StringUtils.isNotBlank(vids) && vids.endsWith(",")) {
					vids = vids.substring(0, vids.length() - 1);
				}
			}
			
            albumTypeName = Mappings.getDictinaryDefaultValue(albumType);
			if (StringUtils.isNotBlank(subCategory)) {
				StringBuilder sb = new StringBuilder();
				StringBuilder sbn = new StringBuilder();
				for (String sc : subCategory.split(",")) {
					if (Mappings.DICTIONARY_MAP.get(sc) != null) {
                        sb.append(Mappings.DICTIONARY_MAP.get(sc).get("value")).append(",");
					}
					if (!sc.equals("")) {
						sbn.append(sc).append(",");
					}
				}
				subCategoryName = sb.toString();
				if (StringUtils.isNotBlank(subCategoryName) && subCategoryName.endsWith(",")) {
					subCategoryName = subCategoryName.substring(0, subCategoryName.length() - 1);
				}
				subCategory = sbn.toString();
				if (StringUtils.isNotBlank(subCategory) && subCategory.endsWith(",")) {
					subCategory = subCategory.substring(0, subCategory.length() - 1);
				}
			}
			if (StringUtils.isNotBlank(fitAge)) {
				StringBuilder sb = new StringBuilder();
				for (String sc : fitAge.split(",")) {
					if (StringUtils.isNotBlank(sc)) {
						sb.append(sc).append(",");
					}
				}
				fitAge = sb.toString();
				if (StringUtils.isNotBlank(fitAge) && fitAge.endsWith(",")) {
					fitAge = fitAge.substring(0, fitAge.length() - 1);
				}
			}
			if (StringUtils.isNotBlank(area)) {
				area = area.replace(",", "");
                areaName = Mappings.getDictinaryDefaultValue(area);
			}
			if (Mappings.DISPLAY_SET.contains(StringUtil.convertObjectToString(m.get("CATEGORY")))) {
				display = Integer.parseInt(Constants.DISPLAY_YES);
			} else {
				display = Integer.parseInt(Constants.DISPLAY_NO);
			}
			if (StringUtils.isNotBlank(actor)) {
				StringBuilder sb = new StringBuilder();
				for (String sc : actor.split(",")) {
					if (Mappings.STAR_MAP.get(sc) != null) {
						sb.append(Mappings.STAR_MAP.get(sc)).append(",");
					}
				}
				actorName = sb.toString();
				if (StringUtils.isNotBlank(actorName) && actorName.endsWith(",")) {
					actorName = actorName.substring(0, actorName.length() - 1);
				}
			}
			m.put("DAY_COUNT", dayCount);
			m.put("ALBUM_TYPE", albumType);
			m.put("ALBUM_TYPE_NAME", albumTypeName);
			m.put("SRC", src);
			m.put("STYLE", style);
			m.put("CATEGORY_NAME", categoryName);
			m.put("SUB_CATEGORY", subCategory);
			m.put("SUB_CATEGORY_NAME", subCategoryName);
			m.put("AREA", area);
			m.put("AREA_NAME", areaName);
			m.put("COUNTRY", country);
			m.put("DIRECTORY", directory);
			m.put("ACTOR", actor);
			m.put("ACTOR_NAME", actorName);
			m.put("ACTOR_PLAY", actorPlay);
			m.put("STARRING", starring);
			m.put("MAKER", maker);
			m.put("R_COMPANY", rCompany);
			m.put("FIT_AGE", fitAge);
			m.put("DISPLAY", display);
			m.put("DATA_TYPE", 1);
			m.put("NAME_JIANPIN", nameJianpin);
			m.put("NAME_QUANPIN", nameQuanpin);
			m.put("ZH_DIRECTORY", zhDirectory);
			m.put("ZH_STARRING", zhStarring);
			m.put("VIDEO_IDS", vids);
			m.put("SERIES_ALBUM_IDS", rAlbums);
			
			return m;
		} catch (Exception e) {
			log.error("process type=album, id=" + m.get("ID") + " error!" + e);
			return m;
		}
	}
	
	public static Map<String, Object> processStar(Map<String, Object> m) {
		try {
			String name = StringUtil.convertObjectToString(m.get("NAME"));
			String nameJianpin = "";
			String nameQuanpin = "";
			String pinyin = LoadDict.chinesePyMap.get(StringUtil.convertObjectToString(m.get("ID")));
			
			if (StringUtils.isNotBlank(pinyin)) {
				String[] words = pinyin.split("@@");
				nameJianpin = words[0];
				nameQuanpin = words[1];
			} else {
				PinyinResult res = PinYinDictionary.getSingleton().converterToSpell(name);
				if (res != null) {
					nameJianpin = res.getFirstSpell();
					nameQuanpin = res.getSpell();
				}
			}
			
			m.put("PUSH_FLAG", "1");
			m.put("DATA_TYPE", 3);
			m.put("NAME_QUANPIN", nameQuanpin);
			m.put("NAME_JIANPIN", nameJianpin);
			Object leId = m.get("LE_ID");
			if (leId == null) {
				return m;
			}
			ArrayList<RelatedStar> list = StarLoading.findRelateList((Long.parseLong(leId.toString())));
			if (null != list) {
				JSONArray starArr = new JSONArray();
				Map<String, Object> starMap = new HashMap<String, Object>();
				for (RelatedStar star:list) {
					starMap.put("leId", star.getLeId());
					starMap.put("starName", star.getStarName());
					starMap.put("relatedScore", star.getRelatedSore());
					starMap.put("starPic", star.getStarPic());
					starArr.add(JSONObject.toJSON(starMap));
				}
				m.put("RELATEDIDS", starArr);
			}
			return m;
		} catch (Exception e) {
			log.error("process type=star, id=" + m.get("ID") + " error!");
			return m;
		}
	}
	
	private static String getVideoImages(String pic_upload,String auto_video_pic,String video_pic){
		String images;
		if (StringUtils.isNotBlank(pic_upload)) {
			images = pic_upload;
		} else {
			Map<String,Object> imagesType = new HashMap<String,Object>();
			Map<String,Object> sizeAndUrl = new HashMap<String,Object>();	
			String value;
			sizeAndUrl.clear();
			value = video_pic + "/thumb/2_100_100.jpg";
			sizeAndUrl.put("100*100",value);
			value = video_pic + "/thumb/2_200_200.jpg";
			sizeAndUrl.put("200*200",value);
			value = video_pic + "/thumb/2_300_300.jpg";
			sizeAndUrl.put("300*300",value);
			imagesType.put("ar11", JSONObject.toJSON(sizeAndUrl));
			
			sizeAndUrl.clear();
			value = video_pic + "/thumb/2_160_90.jpg";
			sizeAndUrl.put("160*90",value);
			value = video_pic + "/thumb/2_320_180.jpg";
			sizeAndUrl.put("320*180",value);
			value = video_pic + "/thumb/2_640_360.jpg";
			sizeAndUrl.put("640*360",value);
			imagesType.put("ar169", JSONObject.toJSON(sizeAndUrl));
			
			sizeAndUrl.clear();
			value = video_pic + "/thumb/2_90_120.jpg";
			sizeAndUrl.put("90*120",value);
			value = video_pic + "/thumb/2_120_160.jpg";
			sizeAndUrl.put("120*160",value);
			value = video_pic + "/thumb/2_150_200.jpg";
			sizeAndUrl.put("150*200",value);
			value = video_pic + "/thumb/2_300_400.jpg";
			sizeAndUrl.put("300*400",value);
			imagesType.put("ar34", JSONObject.toJSON(sizeAndUrl));
			
			sizeAndUrl.clear();
			value = video_pic + "/thumb/2_120_90.jpg";
			sizeAndUrl.put("120*90",value);
			value = video_pic + "/thumb/2_128_96.jpg";
			sizeAndUrl.put("128*96",value);
			value = video_pic + "/thumb/2_132_99.jpg";
			sizeAndUrl.put("132*99",value);
			value = video_pic + "/thumb/2_160_120.jpg";
			sizeAndUrl.put("160*120",value);
			value = video_pic + "/thumb/2_200_150.jpg";
			sizeAndUrl.put("200*150",value);
			value = video_pic + "/thumb/2_400_300.jpg";
			sizeAndUrl.put("400*300",value);
			imagesType.put("ar43", JSONObject.toJSON(sizeAndUrl));
			
			images = JSONObject.toJSONString(imagesType);
			// log.info("pic_upload="+pic_upload+",video_pic="+video_pic+",images="+images);
		}	
		return images;
	}
	
	private static String getVideoImages1(String pic_upload,String auto_video_pic,String video_pic){
		String images;
		if (StringUtils.isNotBlank(pic_upload)) {
			images = pic_upload;
		} else {
			Map<String,Object> imagesType = new HashMap<String,Object>();
			Map<String,Object> sizeAndUrl = new HashMap<String,Object>();	
			String value;
			String temp = video_pic;
			if (StringUtils.isNotBlank(auto_video_pic)) {
				temp = auto_video_pic;
            }
			
			sizeAndUrl.clear();
			value = temp + "/thumb/2_100_100.jpg";
			sizeAndUrl.put("100*100",value);
			value = temp + "/thumb/2_200_200.jpg";
			sizeAndUrl.put("200*200",value);
			value = temp + "/thumb/2_300_300.jpg";
			sizeAndUrl.put("300*300",value);
			imagesType.put("ar11", JSONObject.toJSON(sizeAndUrl));
			
			sizeAndUrl.clear();
			value = temp + "/thumb/2_160_90.jpg";
			sizeAndUrl.put("160*90",value);
			value = temp + "/thumb/2_320_180.jpg";
			sizeAndUrl.put("320*180",value);
			value = temp + "/thumb/2_640_360.jpg";
			sizeAndUrl.put("640*360",value);
			imagesType.put("ar169", JSONObject.toJSON(sizeAndUrl));
			
			sizeAndUrl.clear();
			value = temp + "/thumb/2_90_120.jpg";
			sizeAndUrl.put("90*120",value);
			value = temp + "/thumb/2_120_160.jpg";
			sizeAndUrl.put("120*160",value);
			value = temp + "/thumb/2_150_200.jpg";
			sizeAndUrl.put("150*200",value);
			value = temp + "/thumb/2_300_400.jpg";
			sizeAndUrl.put("300*400",value);
			imagesType.put("ar34", JSONObject.toJSON(sizeAndUrl));
			
			sizeAndUrl.clear();
			value = temp + "/thumb/2_120_90.jpg";
			sizeAndUrl.put("120*90",value);
			value = temp + "/thumb/2_128_96.jpg";
			sizeAndUrl.put("128*96",value);
			value = temp + "/thumb/2_132_99.jpg";
			sizeAndUrl.put("132*99",value);
			value = temp + "/thumb/2_160_120.jpg";
			sizeAndUrl.put("160*120",value);
			value = temp + "/thumb/2_200_150.jpg";
			sizeAndUrl.put("200*150",value);
			value = temp + "/thumb/2_400_300.jpg";
			sizeAndUrl.put("400*300",value);
			imagesType.put("ar43", JSONObject.toJSON(sizeAndUrl));
			
			images = JSONObject.toJSONString(imagesType);
			// log.info("pic_upload="+pic_upload+",video_pic="+video_pic+",images="+images);
		}	
		return images;
	}
	
	public static Map<String, Object> processVideo(Map<String, Object> m) {
		try {
			String style = StringUtil.convertObjectToString(m.get("STYLE"));
			Integer src = -1;
			int videoType = 0;
			String videoTypeName = "";
			String videoTypeStr = StringUtil.convertObjectToString(m.get("VIDEO_TYPE"));
			// 动漫以外其他频道actor字段不建索引
			String actor = null;
			String zhActor = StringUtil.convertObjectToString(m.get("ZH_ACTOR"));
			String area = StringUtil.convertObjectToString(m.get("AREA"));
			String areaName = "";
			String category = StringUtil.convertObjectToString(m.get("CATEGORY"));
            String categoryName = Mappings.getDictinaryDefaultValue(category);
			String directory = StringUtil.convertObjectToString(m.get("DIRECTORY"));
			String rCompany = null;
			String starring = StringUtil.convertObjectToString(m.get("STARRING"));
			String starringPlay = StringUtil.convertObjectToString(m.get("STARTRING_PLAY"));
			String subTitle = StringUtil.convertObjectToString(m.get("SUB_TITLE"));
			String subCategory = StringUtil.convertObjectToString(m.get("SUB_CATEGORY"));
			String subCategoryName = null;
			if (String.valueOf(Constants.SPORTS).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("STYLE"));
			} else if (String.valueOf(Constants.LETVORIGINAL).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("LETV_MAKE_STYLE"));
				starring = StringUtil.convertObjectToString(m.get("COMPERE"));
			} else if (String.valueOf(Constants.FASHION).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("STYLE"));
				starring = StringUtil.convertObjectToString(m.get("COMPERE"));
			} else if (String.valueOf(Constants.LETVPRODUCE).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("LETV_PRODUCE_STYLE"));
			} else if (String.valueOf(Constants.TRAVEL).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("STYLE"));
				subCategory = StringUtil.convertObjectToString(m.get("SUB_CATEGORY"));
			} else if (String.valueOf(Constants.CARTOON).equals(category)) {
				style = StringUtil.convertObjectToString(m.get("STYLE"));
				subTitle = StringUtil.convertObjectToString(m.get("SINGER_NAME"));
				actor = StringUtil.convertObjectToString(m.get("ACTOR"));
			} else if (String.valueOf(Constants.AMUSE).equals(category)) {
				videoTypeStr = StringUtil.convertObjectToString(m.get("SUB_CATEGORY"));
			} else if (String.valueOf(Constants.DOCUMENTARY).equals(category)) {
				starringPlay = StringUtil.convertObjectToString(m.get("SINGER_TYPE"));
				directory = StringUtil.convertObjectToString(m.get("COMPERE"));
			} else if (String.valueOf(Constants.VARIETY).equals(category)) {
				actor = StringUtil.convertObjectToString(m.get("GUEST"));
				directory = StringUtil.convertObjectToString(m.get("COMPERE"));
				if (StringUtils.isNotBlank(actor)) {
					StringBuilder sb = new StringBuilder();
					for (String sc : actor.split(",")) {
						if (Mappings.STAR_MAP.get(sc) != null) {
							sb.append(Mappings.STAR_MAP.get(sc)).append(",");
						}
					}
					zhActor = sb.toString();
					if (StringUtils.isNotBlank(zhActor) && zhActor.endsWith(",")) {
						zhActor = zhActor.substring(0, zhActor.length() - 1);
					}
				}
			} else if (String.valueOf(Constants.OPENCOURSE).equals(category)) {
				directory = StringUtil.convertObjectToString(m.get("INSTRUCTOR"));
				rCompany = StringUtil.convertObjectToString(m.get("SCHOOL"));
			} else if (String.valueOf(Constants.MUSIC).equals(category)) {
				starring = StringUtil.convertObjectToString(m.get("SINGER"));
				starringPlay = StringUtil.convertObjectToString(m.get("SINGER_TYPE"));
				actor = StringUtil.convertObjectToString(m.get("SINGER"));
				zhActor = StringUtil.convertObjectToString(m.get("SINGER"));
				rCompany = StringUtil.convertObjectToString(m.get("RECORD_COMPANY"));
				subCategory = StringUtil.convertObjectToString(m.get("STYLE"));
			} else if (String.valueOf(Constants.CAR).equals(category)) {
				subCategory = StringUtil.convertObjectToString(m.get("STYLE"));
			} else if (String.valueOf(Constants.FINANCE).equals(category)) {
				subCategory = StringUtil.convertObjectToString(m.get("SUB_CATEGORY"));
			}
			if (StringUtils.isNotBlank(subCategory)) {
				StringBuilder sb = new StringBuilder();
				for (String sc : subCategory.split(",")) {
					if (Mappings.DICTIONARY_MAP.get(sc) != null) {
						sb.append(Mappings.DICTIONARY_MAP.get(sc)).append(",");
					}
				}
				subCategoryName = sb.toString();
				if (StringUtils.isNotBlank(subCategoryName) && subCategoryName.endsWith(",")) {
					subCategoryName = subCategoryName.substring(0, subCategoryName.length() - 1);
				}
			}
			if (StringUtils.isNotBlank(area)) {
				area = area.replace(",", "");
                areaName = Mappings.getDictinaryDefaultValue(area);
			}
			if (StringUtils.isNotBlank(videoTypeStr)) {
				videoTypeStr = videoTypeStr.replace(",", "");
				videoType = StringUtil.convertObjectToInteger(videoTypeStr);
				if (videoType != 0) {
                    videoTypeName = Mappings.getDictinaryDefaultValue("" + videoType);
				}
			}
			String name = StringUtil.convertObjectToString(m.get("NAME_CN"));
			String nameJianpin = "";
			String nameQuanpin = "";
			String pinyin = LoadDict.chinesePyMap.get(StringUtil.convertObjectToString(m.get("ID")));
			if (StringUtils.isNotBlank(pinyin)) {
				String[] words = pinyin.split("@@");
				nameJianpin = words[0];
				nameQuanpin = words[1];
			} else {
				PinyinResult res = PinYinDictionary.getSingleton().converterToSpell(name);
				if (res != null) {
					nameJianpin = res.getFirstSpell();
					nameQuanpin = res.getSpell();
				}
			}
			if (200001 == (Integer) m.get("SOURCE_ID")) {
				src = 1;
			} else if (200003 == (Integer) m.get("SOURCE_ID")) {
				src = 3;
			}
			String pic_upload = StringUtil.convertObjectToString(m.get("PIC_UPLOAD"));
			String video_pic = StringUtil.convertObjectToString(m.get("VIDEO_PIC"));
			String auto_video_pic = StringUtil.convertObjectToString(m.get("AUTO_VIDEO_PIC"));
			String images = getVideoImages1(pic_upload, auto_video_pic, video_pic);
			m.remove("PIC_ALL");
			m.put("PIC_ALL", images);
			m.put("VIDEO_TYPE", videoType);
			m.put("VIDEO_TYPE_NAME", videoTypeName);
			m.put("SUB_TITLE", subTitle);
			m.put("CATEGORY_NAME", categoryName);
			m.put("SUB_CATEGORY", subCategory);
			m.put("SUB_CATEGORY_NAME", subCategoryName);
			m.put("AREA", area);
			m.put("AREA_NAME", areaName);
			m.put("STARRING", starring);
			m.put("STARTRING_PLAY", starringPlay);
			m.put("DIRECTORY", directory);
			m.put("ACTOR", actor);
			m.put("R_COMPANY", rCompany);
			m.put("STYLE", style);
			m.put("DATA_TYPE", 2);
			m.put("NAME_QUANPIN", nameQuanpin);
			m.put("NAME_JIANPIN", nameJianpin);
			m.put("SRC", src);
			m.put("ZH_ACTOR", zhActor);
			return m;
		} catch (Exception e) {
			log.error("process type=video, id=" + m.get("ID") + " error!");
			return m;
		}
	}

    private static String getGlobalVids(String aid, String playUrls) {
		if (aid == "" || playUrls == "") {
			return "";
		}
		ArrayList<String> list = new ArrayList<String>();
		String global_vids = "";
		String[] video_infos = playUrls.split(";");
		for(String video_info:video_infos){
			if(!StringUtils.isBlank(video_info)){
				int i = 0;
				String index = "";
				String[] url_infos = video_info.split("\\|");
				for(String url_info:url_infos){
				    if (i == 0) {
				        index = url_info;
				    }
				    i++;
				}
				int num = Collections.frequency(list, index) + 1;
				list.add(index);
				String vid = aid + "_" + index + "_" + num;
				global_vids = global_vids + vid + ";";
			}
		}
	    return global_vids;
	}
	
	public static Map<String, Object> processLeso(Map<String, Object> m) {
		try {
			Integer src = 2;
			String category = StringUtil.convertObjectToString(m.get("category"));
			String srct = StringUtil.convertObjectToString(m.get("source"));
			String aid = StringUtil.convertObjectToString(m.get("id"));
			Object vrsAid = m.get("letv_aid");
            if (null != Mappings.LESO_ID_MAP.get(category)) {
                category = Mappings.LESO_ID_MAP.get(category);
            }
            String categoryName = null;
            if (Constants.WEBSITE_EROS.equals(srct)) {
                src = 5;
                categoryName = Mappings.getDictinaryEnValue(category);
            }
            if (categoryName == null) {
                categoryName = Mappings.getDictinaryDefaultValue(category);
            }
            if(StringUtils.isBlank(categoryName) && !Constants.WEBSITE_EROS.equals(srct)) {
                categoryName = Mappings.CATEGORY_LESO.get(StringUtil.convertObjectToString(m.get("category")));
            }
			String name = StringUtil.convertObjectToString(m.get("name"));
			String nameJianpin = StringUtil.convertObjectToString(m.get("name_first_spell"));
			String nameQuanpin = StringUtil.convertObjectToString(m.get("name_spell"));

			if (StringUtils.isNotBlank(nameJianpin)) {
				PinyinResult res = PinYinDictionary.getSingleton().converterToSpell(name);
				if (res != null) {
					nameJianpin = res.getFirstSpell();
					nameQuanpin = res.getSpell();
				}
			}
			// 直接取数据库的global_vids = vids。
			String playUrls =  StringUtil.convertObjectToString(m.get("playurls"));
			String global_vids = getGlobalVids(aid, playUrls);
//			log.info("id=" + m.get("id") + ", global_vids=" + global_vids);
			m.put("unIds", StringUtil.convertObjectToString(m.get("global_vid")));
			m.put("category", category);
			m.put("categoryName", categoryName);
			m.put("name_quanpin", nameQuanpin);
			m.put("name_jianpin", nameJianpin);
			m.put("data_type", 1);
			m.put("src", src.toString());
			m.put("global_vids", global_vids);

			return m;
		} catch (Exception e) {
			log.error("process type=leso, id=" + m.get("id") + " error!");
			return m;
		}
	}
	
	public static String getIndexAlbumStr(Map<String, Object> m) {
		String record = StringUtil.convertObjectToInteger(m.get("ID")) + "," + StringUtil.convertObjectToInteger(m.get("ALBUM_BASE_TYPE")) 
				+ "," + StringUtil.convertObjectToInteger(m.get("ALBUM_TYPE")) + "," + StringUtil.formatString(m.get("ALBUM_TYPE_NAME"))
				+ "," + StringUtil.convertObjectToInteger(m.get("SOURCE_ID")) + "," + m.get("SRC") + "," + StringUtil.formatString(m.get("NAME_CN")) + "," + StringUtil.formatString(m.get("NAME_PINYIN_ABB"))
				+ "," + StringUtil.formatString(m.get("NAME_EN")) + "," + StringUtil.formatString(m.get("SUB_TITLE")) + "," + StringUtil.formatString(m.get("WEBSITE_TITLE"))
				+ "," + StringUtil.formatString(m.get("MOBILE_TITLE")) + "," + StringUtil.formatString(m.get("TV_TITLE")) + "," + StringUtil.formatString(m.get("ALIAS"))
				+ "," + StringUtil.formatString(m.get("SHORT_DESC")) + "," + StringUtil.formatString(m.get("DESCRIPTION")) + "," + StringUtil.formatString(m.get("TAG"))
				+ "," + m.get("SCORE") + "," + StringUtil.formatString(m.get("STYLE")) + "," + StringUtil.convertObjectToInteger(m.get("CATEGORY")) 
				+ "," + StringUtil.formatString(m.get("CATEGORY_NAME")) + "," + StringUtil.formatString(m.get("SUB_CATEGORY"))
				+ "," + StringUtil.formatString(m.get("SUB_CATEGORY_NAME")) + "," + StringUtil.formatString(m.get("DOWNLOAD_PLATFORM"))
				+ "," + StringUtil.formatString(m.get("PLAY_PLATFORM")) + "," + StringUtil.formatString(m.get("PAY_PLATFORM")) + "," + StringUtil.convertObjectToInteger(m.get("STATUS"))
				+ "," + m.get("DELETED") + "," + StringUtil.convertObjectToInteger(m.get("FID")) + "," + StringUtil.convertObjectToInteger(m.get("FORDER"))
				+ "," + m.get("IS_END") + "," + m.get("IS_HEIGHT") + "," + m.get("ALLOW_FORGIEN_PLATFORM") + "," + StringUtil.convertObjectToInteger(m.get("AREA"))
				+ "," + StringUtil.formatString(m.get("AREA_NAME")) + "," + m.get("COUNTRY") + "," + StringUtil.convertObjectToInteger(m.get("COPYRIGHT_TYPE")) + "," + StringUtil.convertObjectToInteger(m.get("DURATION"))
				+ "," + StringUtil.formatDate(m.get("RELEASE_DATE"), false) + "," + StringUtil.formatTime(m.get("LETV_RELEASE_DATE")) + "," + StringUtil.formatString(m.get("DOUBAN_ID"))
				+ "," + m.get("EPISODE") + "," + StringUtil.formatString(m.get("PLAY_STATUS")) + "," + StringUtil.formatString(m.get("MAKER_COMPANY"))
				+ "," + StringUtil.formatString(m.get("DIRECTORY")) + "," + StringUtil.formatString(m.get("ACTOR")) + "," + StringUtil.formatString(m.get("ACTOR_NAME")) + "," + StringUtil.formatString(m.get("ACTOR_PLAY")) /*+ "," + StringUtil.formatString(m.get("ACTOR_PLAY_NAME"))*/
				+ "," + StringUtil.formatString(m.get("STARRING")) + "," + StringUtil.formatString(m.get("STARRING_PLAY")) + "," + StringUtil.formatString(m.get("PIC_COLLECTIONS"))
				+ "," + StringUtil.formatString(m.get("PIC_ORIGINAL")) + "," + StringUtil.formatString(m.get("SCREEN_WRITER")) + "," + StringUtil.formatString(m.get("MAKER"))
				+ "," + StringUtil.formatString(m.get("R_COMPANY")) + "," + m.get("LANGUAGE") + "," + StringUtil.formatString(m.get("FIT_AGE"))
				+ "," + StringUtil.convertObjectToInteger(m.get("RECOMM_LEVEL")) + "," + StringUtil.formatString(m.get("MUSIC_AUTHORS")) + "," + StringUtil.formatString(m.get("MUSIC_COMPOSE"))
				+ "," + StringUtil.convertObjectToInteger(m.get("PROGRAM_STYLE")) + "," + StringUtil.formatString(m.get("PLAY_TV")) + "," + m.get("IS_FOLLOW")
				+ "," + StringUtil.convertObjectToInteger(m.get("ALLOW_MONTH")) + "," + m.get("IS_PAY")
				+ "," + StringUtil.formatString(m.get("PAY_PRODUCT")) + "," + StringUtil.formatString(m.get("RELATION_ID")) + "," + StringUtil.convertObjectToInteger(m.get("IS_HOMEMADE"))
				+ "," + StringUtil.formatString(m.get("VARIETY_SHOW"))
				+ "," + StringUtil.formatTime(m.get("CREATE_TIME")) + "," + StringUtil.formatTime(m.get("UPDATE_TIME")) + "," + StringUtil.formatString(m.get("VIDEO_IDS"))
				+ "," + m.get("NOW_EPISODE") + "," + StringUtil.formatString(m.get("PLAY_STREAM")) + "," + m.get("IS_DISPLAY")
				+ "," + StringUtil.convertObjectToInteger(m.get("DAY_COUNT")) + "," + StringUtil.convertObjectToInteger(m.get("MONTH_COUNT")) + "," + StringUtil.convertObjectToInteger(m.get("WEEK_COUNT")) 
				+ "," + StringUtil.convertObjectToInteger(m.get("PLAY_COUNT")) + "," + StringUtil.formatString(m.get("NAME_JIANPIN")) + "," + StringUtil.formatString(m.get("NAME_QUANPIN"))
				+ "," + StringUtil.formatString(m.get("VID_EPISODE")) + "," + StringUtil.formatString(m.get("ZH_DIRECTORY"))
				+ "," + StringUtil.formatString(m.get("ZH_STARRING")) + "," + StringUtil.formatString(m.get("APPID"))
				+ "," + m.get("PLAY_CONTROL_PLATFORM_CNTV") + "," + m.get("PLAY_CONTROL_PLATFORM_HUASHU") + "," + m.get("PLAY_CONTROL_PLATFORM_GUOGUANG")
				+ "," + StringUtil.formatString(m.get("RECORD_COMPANY"))
				+ "," + StringUtil.formatString(m.get("SERIES_ALBUM_IDS"))
				+ "," + StringUtil.formatTime(m.get("VIDEO_FOLLOW_TIME"))
				+ "," + m.get("CONTENT_RATING") + "," + StringUtil.formatString(m.get("ALBUM_PIC")) + "," + StringUtil.formatString(m.get("EXT_DATA"));
		
		return record;
	}
	

	public static String getIndexStarStr(Map<String, Object> m) {
		String record = m.get("ID") + "," + StringUtil.formatString(m.get("NAME")) + "," + StringUtil.formatString(m.get("ENGLISHNAME"))
				+ "," + StringUtil.formatString(m.get("OTHERNAME")) + "," + StringUtil.formatString(m.get("TRUENAME")) + "," + StringUtil.formatString(m.get("BIRTHDAY"))
				+ "," + StringUtil.formatString(m.get("GENDER")) + "," + StringUtil.formatString(m.get("AREA")) + "," + StringUtil.formatString(m.get("AREA_NAME")) 
				+ "," + StringUtil.formatString(m.get("DESCRIPTION")) + "," + m.get("DISPLAY") + "," + m.get("ISACTOR") + "," + m.get("ISDIRECTOR")
				+ "," + m.get("IS_AVAIL") + "," + StringUtil.formatString(m.get("PROFESSIONAL")) + "," + StringUtil.formatString(m.get("STATUS"))
				+ "," + StringUtil.formatString(m.get("POST_S1")) + "," + StringUtil.formatString(m.get("POST_S2")) + "," + StringUtil.formatString(m.get("POST_S3"))
				+ "," + StringUtil.formatString(m.get("POST_H1")) + "," + StringUtil.formatString(m.get("POST_H2")) + "," + m.get("DELETED")
				+ "," + m.get("ISEND") + "," + StringUtil.formatString(m.get("PUSH_FLAG")) + "," + StringUtil.formatString(m.get("POST_ORIGIN"))
				+ "," + StringUtil.formatString(m.get("PINYINABB")) + "," + StringUtil.formatTime(m.get("CREATE_TIME")) + "," + StringUtil.formatTime(m.get("UPDATE_TIME"))
				+ "," + m.get("USER_ID") + "," + m.get("UPDATE_UID") + "," + StringUtil.formatString(m.get("NAME_QUANPIN")) + "," + StringUtil.formatString(m.get("NAME_JIANPIN"))
				+ "," + StringUtil.formatString((m.get("RELATEDIDS") == null) ? null :(JSONObject.toJSONString(m.get("RELATEDIDS"))));
		
		return record;
	}
	
	public static String getIndexVideoStr(Map<String, Object> m) {
		String record = m.get("ID") + "," + m.get("SOURCE_ID") + "," + m.get("VIDEO_TYPE") + "," + StringUtil.formatString(m.get("VIDEO_TYPE_NAME"))
				+ "," + m.get("PID") + "," + m.get("PORDER") + "," + StringUtil.formatString(m.get("MID"))
				+ "," + StringUtil.formatString(m.get("NAME_CN")) + "," + StringUtil.formatString(m.get("NAME_PINYIN_ABB")) + "," + StringUtil.formatString(m.get("NAME_EN"))
				+ "," + StringUtil.formatString(m.get("ALIAS")) + "," + StringUtil.formatString(m.get("SUB_TITLE")) + "," + StringUtil.formatString(m.get("WEBSITE_TITLE"))
				+ "," + StringUtil.formatString(m.get("MOBILE_TITLE")) + "," + StringUtil.formatString(m.get("TV_TITLE")) + "," + StringUtil.formatString(m.get("SHORT_DESC"))
				+ "," + StringUtil.formatString(m.get("DESCRIPTION")) + "," + StringUtil.formatString(m.get("TAG")) + "," + StringUtil.formatString(m.get("CATEGORY"))
				+ "," + StringUtil.formatString(m.get("CATEGORY_NAME")) + "," + StringUtil.formatString(m.get("SUB_CATEGORY"))
				+ "," + StringUtil.formatString(m.get("SUB_CATEGORY_NAME")) + "," + StringUtil.formatString(m.get("EPISODE")) + "," + StringUtil.formatString(m.get("WATCHING_FOCUS"))
				+ "," + m.get("COPYRIGHT_TYPE") + "," + StringUtil.formatString(m.get("COPYRIGHT_COMPANY")) + "," + m.get("DISABLE_TYPE")
				+ "," + StringUtil.formatString(m.get("CONTROL_AREAS")) + "," + StringUtil.formatString(m.get("DOWNLOAD_PLATFORM")) + "," + StringUtil.formatString(m.get("PLAY_PLATFORM"))
				+ "," + StringUtil.formatString(m.get("PAY_PLATFORM")) + "," + StringUtil.formatString(m.get("DURATION")) + "," + StringUtil.formatString(m.get("SCHEDULE_PUBLISH_DATE"))
				+ "," + StringUtil.formatString(m.get("STATUS")) + "," + m.get("DELETED") + "," + m.get("SCORE")
				+ "," + StringUtil.formatString(m.get("PIC_ALL")) + "," + StringUtil.formatString(m.get("PIC_ORIGINAL")) + "," + StringUtil.formatDate(m.get("RELEASE_DATE"), false)
				+ "," + StringUtil.formatString(m.get("AREA")) + "," + StringUtil.formatString(m.get("AREA_NAME")) + "," + m.get("ISSUE") + "," + m.get("IS_HOMEMADE") + "," + StringUtil.formatString(m.get("STARRING"))
				+ "," + StringUtil.formatString(m.get("STARTRING_PLAY")) + "," + StringUtil.formatString(m.get("DIRECTORY")) + "," + StringUtil.formatString(m.get("ACTOR"))
				+ "," + StringUtil.formatString(m.get("ACTOR_PLAY")) + "," + StringUtil.formatString(m.get("R_COMPANY")) + "," + m.get("LANGUAGE")
				+ "," + StringUtil.formatString(m.get("STYLE")) + "," + StringUtil.formatString(m.get("MUSIC_AUTHORS")) + "," + StringUtil.formatString(m.get("MUSIC_COMPOSE"))
				+ "," + StringUtil.formatString(m.get("CREATE_TIME")) + "," + StringUtil.formatString(m.get("UPDATE_TIME"))
				+ "," + StringUtil.formatString(m.get("PLAY_STREAM")) + "," + m.get("DAY_COUNT") + "," + StringUtil.formatString(m.get("NAME_QUANPIN")) + "," + StringUtil.formatString(m.get("NAME_JIANPIN")) 
				+ "," + m.get("SRC") + "," + StringUtil.formatString(m.get("ZH_ACTOR")) + "," + StringUtil.formatString(m.get("ZH_DIRECTORY"))
				+ "," + StringUtil.convertObjectToInteger(m.get("PLAY_COUNT")) + "," + StringUtil.formatString(m.get("APPID")) + "," + m.get("USER_ID")
				+ "," + m.get("PLAY_CONTROL_PLATFORM_CNTV") + "," + m.get("PLAY_CONTROL_PLATFORM_HUASHU") + "," + m.get("PLAY_CONTROL_PLATFORM_GUOGUANG")
				+ "," + StringUtil.formatString(m.get("PLAY_TV")) + "," + StringUtil.formatString(m.get("RECORD_COMPANY")) + "," + StringUtil.formatString(m.get("VIDEO_PIC")) + "," + StringUtil.formatString(m.get("PIC_UPLOAD"))
				+ "," + m.get("CONTENT_RATING") + "," + StringUtil.formatString(m.get("AUTO_VIDEO_PIC"));
		
		return record;
	}
	
	public static String getIndexLesoStr(Map<String, Object> m) {
		String record = m.get("id") + "," + StringUtil.formatString(m.get("name")) + "," + StringUtil.formatString(m.get("source"))
				+ "," + StringUtil.formatString(m.get("subname")) + "," + StringUtil.formatString(m.get("name_spell")) + "," + StringUtil.formatString(m.get("name_first_spell"))
				+ "," + StringUtil.formatString(m.get("othername")) + "," + StringUtil.formatString(m.get("name_fr")) + "," + m.get("category") + "," + StringUtil.formatString(m.get("categoryName"))
				+ "," + StringUtil.formatString(m.get("director")) + "," + StringUtil.formatString(m.get("actor")) + "," + StringUtil.formatString(m.get("subCategoryName"))
				+ "," + StringUtil.formatString(m.get("areaName")) + "," + StringUtil.formatString(m.get("language")) + "," + StringUtil.formatDate(m.get("releaseDate"), true)
				+ "," + StringUtil.formatString(m.get("shortDesc")) + "," + StringUtil.formatString(m.get("description")) + "," + m.get("rating")
				+ "," + StringUtil.formatString(m.get("poster")) + "," + StringUtil.formatString(m.get("postS1")) + "," + StringUtil.formatString(m.get("postS2"))
				+ "," + StringUtil.formatString(m.get("postS3")) + "," + StringUtil.formatString(m.get("duration")) + "," + StringUtil.formatString(m.get("tag"))
				+ "," + StringUtil.formatString(m.get("hasvideo_pc")) + "," + m.get("hasvideo") + "," + m.get("hasvideo_mobile")
				+ "," + m.get("vid") + "," + StringUtil.formatString(m.get("playurls")) + "," + StringUtil.formatString(m.get("intro"))
				+ "," + m.get("episodes") + "," + StringUtil.formatString(m.get("playStatus")) + "," + m.get("currentEpisode")
				+ "," + StringUtil.formatString(m.get("quality")) + "," + m.get("playCount") + "," + m.get("dayCount")
				+ "," + m.get("weekCount") + "," + m.get("monthCount") + "," + StringUtil.formatString(m.get("photosurl"))
				+ "," + StringUtil.formatString(m.get("url")) + "," + StringUtil.formatString(m.get("detail_link"))
				+ "," + StringUtil.formatString(m.get("pushflag")) + "," + StringUtil.formatString(m.get("is_pay"))
				+ "," + StringUtil.formatString(m.get("name_quanpin")) + "," + StringUtil.formatString(m.get("name_jianpin"))
				//+ "," + StringUtil.formatString(m.get("actor_id")) + "," + StringUtil.formatString(m.get("director_id")) + "," + StringUtil.formatString(m.get("uniIds"))
				+ "," + m.get("src") + "," + StringUtil.formatString(m.get("deadlinks")) + "," + StringUtil.formatString(m.get("global_vids"))
				+ "," + StringUtil.convertObjectToInteger(m.get("video_type"))
				+ "," + StringUtil.formatString(m.get("cmsImages"))+ "," + m.get("source_num")+ "," + StringUtil.formatString(m.get("starring_leids"))
				+ "," + StringUtil.formatTime(m.get("video_follow_time")) + "," + StringUtil.formatString(m.get("white_list"))
				+ "," +  StringUtil.formatString(m.get("external_ids")) + "," +  StringUtil.formatString(m.get("mids")) 
                + "," + StringUtil.formatString(m.get("letvOriginalId")) + "," + StringUtil.formatString(m.get("svids"))
                + "," + m.get("external_rank") + "," + StringUtil.formatString(m.get("source_list")) + ","
                + m.get("content_type") + "," + StringUtil.formatTime(m.get("create_time")) + ","
                + StringUtil.formatTime(m.get("update_time")) + "," + StringUtil.formatString(m.get("display_area")) + "," + m.get("cp_info_id")
                + "," + StringUtil.formatString(m.get("cp_letv_original_id")) + "," + StringUtil.formatString(m.get("album_pay_platform"))
                + "," + StringUtil.formatString(m.get("h5_blocked_city_level")) + "," + StringUtil.formatString(m.get("letv_orininal_svids"))
                + "," + StringUtil.convertObjectToInteger(m.get("is_cibn_checked"))
		        + "," + StringUtil.convertObjectToInteger(m.get("if_default_source"))
		        + "," + StringUtil.formatString(m.get("external_id"))
		        + "," + StringUtil.convertObjectToInteger(m.get("is_cibn_show"))
		        + "," + StringUtil.formatString(m.get("external_play_id"))
		        + "," + StringUtil.formatString(m.get("external_play_ids"))
		        + "," + StringUtil.formatString(m.get("le_id"))
		        + "," + StringUtil.formatString(m.get("area"))
		        + "," + StringUtil.formatString(m.get("sub_category"));
		return record;
	}

	public static Map<String, Object> getCBaseMap(Map<String, Object> f, Map<String, Object> m, String type) {
		HashMap<String, Object> indexMap = new HashMap<String, Object>();
		Set<Entry<String, Object>> entrySet = f.entrySet();
		String directory = "";
		String starring = "";	
		if (type.equals("leso")) {
			for (Entry<String, Object> entry : entrySet) {
				Object colValue = m.get(String.valueOf(entry.getValue()));
				if (colValue instanceof Boolean) {
					if (((Boolean)colValue)) {
						colValue = "1";
					} else {
						colValue = "0";
					}
				}
				indexMap.put(entry.getKey(), colValue);
			}
			directory = String.valueOf(m.get("director_id"));
			starring =  String.valueOf(m.get("actor_id"));
		
			log.debug("directory="+directory);
			log.debug("starring="+starring);
			
			setPoster(indexMap,directory,"directoriesPoster");
			setPoster(indexMap,starring,"starsPoster");	
			jsonStr2JsonArray(indexMap,String.valueOf(m.get("cmsImages")),"cmsImages");

			String album_external_play_id = (null == indexMap.get("external_play_id")) ? "" : indexMap.get("external_play_id").toString();
			indexMap.put("external_play_id", transToJson(album_external_play_id));
			String source_list_json = (null == indexMap.get("source_list_json")) ? "" : indexMap.get("source_list_json").toString();
			indexMap.put("source_list_json", transToJson(source_list_json));
		} else {
				int cat =0;
				for (Entry<String, Object> entry : entrySet) {
					String dbfield = String.valueOf(entry.getValue()).toUpperCase();
					Object colValue = m.get(dbfield);
					
					if(dbfield.equalsIgnoreCase("CATEGORY"))
						cat =((Integer)colValue).intValue();

					if (colValue instanceof Boolean) {
						if (((Boolean)colValue)) {
							colValue = "1";
						} else {
							colValue = "0";
						}
					}
					indexMap.put(entry.getKey(), colValue);
	
				}
				//put directory staring poster			
				if(type.equals("album")){
					if( 5 == cat ) {
						directory = String.valueOf(m.get("ORIGINATOR"));
						starring =  String.valueOf(m.get("CAST"));				
					}else{
						directory = String.valueOf(m.get("DIRECTORY"));
						starring =  String.valueOf(m.get("STARRING"));
					}
					log.debug("cat="+cat);
					log.debug("directory="+directory);
					log.debug("starring="+starring);
					
					setPoster(indexMap,directory,"directoriesPoster");
					setPoster(indexMap,starring,"starsPoster");	
				}
				
		}
		
		return indexMap;
	}

	private static JSONObject transToJson(String value) {
	    JSONObject result = new JSONObject();
        if(!StringUtils.isBlank(value)) {
            try {
                result = JSON.parseObject(value);
            } catch(Exception e) {
                log.error("fail to tans to json");
            }
        }
        return result;
    }

    private static void jsonStr2JsonArray(HashMap<String, Object> indexMap,
			String valueOf, String key) {
		JSONArray directoryArray = new JSONArray();
		if (StringUtils.isNotEmpty(valueOf)) {
	        directoryArray = JSONObject.parseArray(valueOf);
		}
		indexMap.put(key, directoryArray);
		
	}
	private static void setPoster(Map<String, Object> indexMap,String rule,String key){
		int i=0;
		JSONArray directoryArray = new JSONArray();
		if(!StringUtils.isBlank(rule)){
			rule = rule.replace(";", ",");
			String[] directories = rule.split(",");
			Map<String,Object> directoryMap = new HashMap<String,Object>();
			for(String dirctor:directories){
				if(!StringUtils.isBlank(dirctor) && (!"0".equals(dirctor)) && i<=12){
					String poster = Mappings.STAR_PIC_MAP.get(dirctor);
					String name = Mappings.STAR_MAP.get(dirctor);
					
					if (StringUtils.isBlank(poster) || StringUtils.isBlank(name)) {//过滤不存在的名字和海报
	                    continue;
                    }
					directoryMap.put("id", dirctor);
					directoryMap.put("poster", poster);
					directoryMap.put("name", name);	

					directoryArray.add(JSONObject.toJSON(directoryMap));
					directoryMap.clear();
					i++;
				}

			}

			indexMap.put(key, directoryArray);
		}
	}
	
	public static void setEpisodes(Map<String, Object> dest,
			Map<String, Object> src,
			ArrayList<Map<String, Object>> videolists) {
	        if (src.get("episodes") ==null ||  "1".equals(src.get("episodes").toString())) {
	            dest.put("episodes", videolists.size()); 
	        } else {
	            dest.put("episodes", src.get("episodes")); 
	        }
	}
}